/**
 * User: ksyunyaka
 * Date: 11.12.11
 */
package org.electronic.registration.bo {
import flexlib.scheduling.scheduleClasses.ColoredScheduleEntry;
import flexlib.scheduling.util.DateUtil;

[RemoteClass(alias="org.electronic.registration.bo.Scheduler")]
public class SchedulerEntry extends ColoredScheduleEntry {
    public function SchedulerEntry() {
    }

    private var _id:Number;

    private var _doctor:Doctor;

    private var _patient:Patient;

    private var _startDate:Date;

    private var _endDate:Date;

    public var width:Number = 140;


    public function get id():Number {
        return _id;
    }

    public function set id(value:Number):void {
        _id = value;
    }

    public function get doctor():Doctor {
        return _doctor;
    }

    public function set doctor(value:Doctor):void {
        _doctor = value;
    }

    override public function get startDate():Date {
        return formatDate(_startDate);
    }

    override public function get endDate():Date {
        return formatDate(_endDate);
    }


    override public function set startDate(value:Date):void {
        _startDate = value;
    }


    override public function set endDate(value:Date):void {
        _endDate = value;
    }

    public function getOriginalStartDate():Date {
        return _startDate;
    }

    public function getOriginalEndDate():Date {
        return _endDate;
    }

    private function formatDate(date:Date):Date {
        return new Date(DateUtil.HOUR_IN_MILLISECONDS * date.getHours() + DateUtil.MINUTE_IN_MILLISECONDS * date.getMinutes());
    }


    public function get patient():Patient {
        return _patient;
    }

    public function set patient(value:Patient):void {
        _patient = value;
    }
}
}
